package tools

import (
	"golang.org/x/crypto/bcrypt"
)

func GetPwd(pwd string) string {
	// 加密
	password, _ := bcrypt.GenerateFromPassword([]byte(pwd), bcrypt.DefaultCost)
	return string(password)
}

func ComparePwd(Encrypted string, pwd string) bool {
	err := bcrypt.CompareHashAndPassword([]byte(Encrypted), []byte(pwd))
	return err == nil
}
